package lucid.hrms.management.language;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;

import lucid.hrms.util.CommonHelper;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "language")
public class Language implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(generator = "hibernate_sequence")
	@GenericGenerator(name = "hibernate_sequence", strategy = "seqhilo", parameters = { @Parameter(name = "max_lo", value = "5"),
			@Parameter(name = "sequence", value = "language") })
	@Column(name = "id")
	private Long id;

	@NotEmpty
	@Pattern(regexp = "^[A-Za-z]+( [A-Za-z]+)*$", message = "{lucid.hrms.constraints.Alphabets}")
	@Column(name = "name", unique = true, nullable = false)
	private String name;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return CommonHelper.toString(Language.class, this);
	}
}
